<template>
	<view style="width:100%">
		<input placeholder="请输入车牌号" disabled="inputDisabled" @tap="plateShow = true" v-model.trim="plateNo" style="width:100%;font-size: 28rpx;" />
		<plate-input v-if="plateShow" :plate="plateNo" @export="setPlate" @close="plateShow = false" />
	</view>
</template>

<script>
	import plateInput from '@/components/uni-plate-input/uni-plate-input.vue';
	export default {
		components: {
			plateInput
		},
		props: {
			value: {
				type: String,
				default: null
			}
		},
		watch:{
			value(newVal){
				this.plateNo = newVal
			}
		},
		data() {
			return {
				plateNo: '',
				plateShow: false,
				inputDisabled: true
			}
		},
		methods: {
			setPlate(plate) {
				if (plate.length >= 7) this.plateNo = plate;
				this.plateShow = false;
				console.log(this.plateNo)		
				this.$emit('input',this.plateNo)
			}
		}
	}
</script>

<style>

</style>
